<!DOCTYPE html>
<html>
<head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
    <title>收货地址</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, user-scalable=no, maximum-scale=1.0" />
    <meta content="yes" name="apple-mobile-web-app-capable" />
    <meta content="black" name="apple-mobile-web-app-status-bar-style" />
    <meta content="telephone=no" name="format-detection" />
    <link href="../assets/mobile/comm.css" rel="stylesheet" type="text/css" />
	<link href="../assets/mobile/login.css" rel="stylesheet" type="text/css" />
	<script src="../assets/js/mobile/jquery190.js" type="text/javascript"></script>
	<link rel="stylesheet" href="../assets/mobile/top.css">
	<link rel="stylesheet" href="../assets/mobile/aui.css">
	<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/config.js"></script>
<script type="text/javascript" src="../script/local.js"></script>
<script type="text/javascript" src="../script/common.js"></script>
</head>
<body style="background:#fff;">
<style type="text/css">
body,#wrapper{position:static !important;}
#header{
	border:none;
}
#header,#header .titlebar{
	background-color:#DD3E96;
	color:#fff !important;
}
#header h1{
	color:#fff !important;
}
.pull-left,.pull-right{
	color:#fff !important;
}	
</style>
<style>
.registerCon select{
	background: #FFF none repeat scroll 0% 0%;
	border: 5px solid #DDD;
	color: #CCC;
	border-radius: 5px;
	padding: 0px 5px;
	display: inline-block;
	position: relative;
	font-size: 16px;
	height: 50px;
	width: 101%;
}
.registerCon .loading{
	padding-top: 20px;
	color: #999;
}
.registerCon .form{
	display:none;
}
</style>

<section id="wrapper" style="margin-top:0px !important;top:10px !important;">
<div>
 		<div class="block10"></div>
		<div class="aui-content aui-card">
        <div class="aui-form">
			<div class="aui-input-row">
                <span class="aui-input-addon">省</span>
                <input name="province" type="text" class="aui-input"/>
            </div>

            <div class="aui-input-row">
                <span class="aui-input-addon">市</span>
                <input name="city" type="text" class="aui-input" />
            </div>
            <div class="aui-input-row">
                <span class="aui-input-addon">区/县</span>
                <input name="area" type="text" class="aui-input"/>
            </div>
            <div class="aui-input-row">
                <span class="aui-input-addon">详细地址</span>
                <input name="jiedao" type="text" class="aui-input" />
            </div>
            <div class="aui-input-row">
                <span class="aui-input-addon">邮政编码</span>
                <input name="youbian" type="text" class="aui-input"/>
            </div>
			<div class="aui-input-row">
                <span class="aui-input-addon">收货人</span>
                <input name="shouhuoren" type="text" class="aui-input"/>
            </div>
			<div class="aui-input-row">
                <span class="aui-input-addon">手机号</span>
                <input name="mobile" type="text" class="aui-input"/>
            </div>
		<div class="aui-input-row">
                <span class="aui-input-addon">默认使用</span>
                <input type="radio" value="Y" checked="checked" name="_default"/>是&nbsp;&nbsp;
				<input type="radio" value="N" name="_default"/>否
            </div>
            <div class="aui-btn-row">
				<input style="margin-right:20px;" name="submit" class="aui-btn aui-btn-block aui-btn-success common-btn" id="btn_consignee_save" value="保存" title="保存提交" type="submit"> 	
            </div>

        </div>
    </div>




 <div class="block20"></div>
</div>
</section>

<link rel="stylesheet" href="../assets/agile/css/ratchet/css/ratchet.min.css">
<link rel="stylesheet" href="../assets/agile/css/flat/flat.component.css">
<link rel="stylesheet" href="../assets/agile/css/flat/iconline.css">
<link rel="stylesheet" href="../assets/agile/css/flat/iconform.css">
<style>
.head-shopcart{
	position:relative;
}
.pPic{padding-bottom:5px !important;}
.footer_goods_num{
	display:none;
	font-size:12px;
	background:red;
	border-radius:50%;
	position:absolute;
	top:1px;
	font-style:normal;
	left:42px;
	width:20px;
	height:20px;
	line-height:20px;
	z-index:999;
	color:#fff;
}
nav.bar-tab span.tab-label{margin-top:-1px;}
nav.bar-tab span.icon{font-size:20px;margin-top:1px;}
nav.bar-tab{
	background-image: linear-gradient(to top,#f9f9f9,#ececec);
    background-image: -webkit-linear-gradient(to top,#f9f9f9,#ececec); /* Safari 5.1 - 6.0 */
	background-image: -o-linear-gradient(to top,#f9f9f9,#ececec); /* Opera 11.1 - 12.0 */
	background-image: -moz-linear-gradient(to top,#f9f9f9,#ececec); /* Firefox 3.6 - 15 */
	background-image: linear-gradient(to top,#f9f9f9,#ececec);
	border-color:#c0bfbf;
}
.bar-tab a{
	width:20%;
}
</style>
<script type="text/javascript">
apiready = function(){
$(function(){
     var userinfo = localData.get('userinfo');
	 var userinfo = JSON.parse(userinfo);
	 if(userinfo != undefined && typeof userinfo == 'object' && userinfo != null){
		 $('input[name=submit]').click(function(){
		      var provice = $('input[name=province]').val();
		      if(provice == ''){
		          $.PageDialog.fail("请输入省份");
		          return false;
		      }
	       var city = $('input[name=city]').val();
	                     if(city == ''){
                  $.PageDialog.fail("请输入城市名称");
                  return false;
              }
	        var area = $('input[name=area]').val();
	                     if(area == ''){
                  $.PageDialog.fail("请输入区域");
                  return false;
              }
	        var jiedao = $('input[name=jiedao]').val();
	              if(jiedao == ''){
                  $.PageDialog.fail("请输入详细地址");
                  return false;
              }
	        var shouhuoren = $('input[name=shouhuoren]').val();
	          if(shouhuoren == ''){
                  $.PageDialog.fail("请输入省份");
                  return false;
              }
	         var youbian = $('input[name=youbian]').val();
	          if(youbian == ''){
                  $.PageDialog.fail("请输入邮编");
                  return false;
              }
              if(!checkZipcode(youbian)){
                  $.PageDialog.fail("邮编格式不正确");
                  return false;
              }
	         var mobile = $('input[name=mobile]').val();
	          if(mobile == ''){
                  $.PageDialog.fail("请输入手机号码");
                  return false;
              }
              if(!checkMobile(mobile)){
                  $.PageDialog.fail("手机号码格式不正确");
                  return false;
              }
			  var _default = $('input[name=_default]:checked').val();
              api.showProgress({title:'正在保存'});
              PostData(config.url+"/app.php?act=addaddress&uid="+userinfo['uid'],{
                     'province' : provice,
                     'city' : city,
                     'area' : area,
                     'truename' : shouhuoren,
                     'zipcode' : youbian,
                     'mobile' : mobile,
                     'jiedao' : jiedao,
					 '_default' : _default
                  },function(res){
                      api.hideProgress();
                      if(res['status'] == 1){
                    	  localData.set('add_address_ok',1);
                          $.PageDialog.ok("<s></s>"+ res['msg']);
						  var reloadPage = localData.get('reload');
						  localData.remove('reload');
						  if(reloadPage == 'z_payment'){
								var jsfun = 'funcGoto();';
								api.execScript({
								    name: 'z_payment',
								    script: jsfun
								});
						  }
                          setTimeout(function(){
                              appClose('add_address',api);
                          },2000);
                      }else{
                          $.PageDialog.fail(res['msg']);
                      }
                  });
		 });
	 }else{
	     randomSwitchBtn('login',api);
	 }
});
};
</script>
</body>
</html>